#ifndef SHIP_MANAGER_HPP
#define SHIP_MANAGER_HPP

#include <iostream>

#include <Ogre.h>

#include <OgreNewt.h>

//#include <boost\config.hpp>
//#include <boost\program_options\detail\config_file.hpp>
//#include <boost\program_options\parsers.hpp>

//#include <boost/property_tree/ptree.hpp>
//#include <boost/property_tree/ini_parser.hpp>

//#include "DB_Parser.h"

#include "ShipObject.hpp"
#include "ShipInput.hpp"

typedef std::pair<std::string, ShipTemplate*> ShipTemplatePair;
typedef std::pair<std::string, ShipObject*> ShipListPair;

using namespace Ogre;

class ShipManager
{
	public:

		// Constructor/Destructor
		ShipManager();
		~ShipManager();

		void createShipManager(SceneManager* i_pSceneMgr, OgreNewt::World* i_pPhysWorld);
		void setSceneManager(SceneManager* i_pSceneMgr);

		void spawnNewShip(std::string i_sShipTemplateName, ShipInput* i_pShipInput = 0,
						   std::string i_sShipName = "NoName",
						   Vector3 i_ShipLocation = Vector3(0.0f, 0.0f, 0.0f),
						   Quaternion i_ShipOrientation = Quaternion::IDENTITY);

		void parseShipFile(std::string i_sFileName);

		ShipObject* getShipPointerByName(std::string i_sShipName);

		void deleteShip(std::string i_sShipName);

		void updateShipManager(double timeSinceLastFrame);

		ShipTemplate* getShipTemplateByName(const std::string i_sTemplateName);

	private:

		OgreNewt::World* m_pPhysWorld;
		
		SceneManager*	m_pSceneMgr;

		std::map<std::string, ShipObject*> m_ShipList;

		std::map<std::string, ShipTemplate*> m_ShipTemplateList;

		std::string GenerateShipName(std::string i_sModelName);

		void eraseShipTemplateContents();
		void eraseShipListContents();
};

#endif